package com.tnl.hunter.webchat.common;

import com.biz.hunter.dao.DictionaryDAO;
import com.biz.hunter.db.entity.Dictionary;
import com.tnl.hunter.webchat.utils.SMSService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Objects;

@Component
public class MsgService {

    @Autowired
    private DictionaryDAO dictionaryDAO;

    public void toSendMsgToService(String content) throws Exception {
        List<Dictionary> dictionaryList = dictionaryDAO.getByType("service_phone");
        if (!Objects.isNull(dictionaryList)){
            Dictionary dictionary = dictionaryList.get(0);
            SMSService.sendAskMsg(dictionary.getValue(), content);
        }
    }
}
